﻿using Purchase.Domain;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;

namespace Purchase.ReadAPI.DTOs.采购管理
{
    /// <summary>
    /// 物料清单主表实体DTOs
    /// </summary>
    public class BillOfMaterialDto
    {
        /// <summary>
        /// 物料清单ID，主键，自增长
        /// </summary>
        public int BomId { get; set; }

        /// <summary>
        /// 物料清单编号，必填，最大长度50
        /// </summary>
        public string BomNumber { get; set; }

        /// <summary>
        /// 物料清单主题，最大长度100
        /// </summary>
        public string BomSubject { get; set; }

        /// <summary>
        /// 产品名称，必填，最大长度100
        /// </summary>
        public string ProductName { get; set; }

        /// <summary>
        /// 产品编码，最大长度50
        /// </summary>
        public string ProductCode { get; set; }

        /// <summary>
        /// 规格型号，最大长度100
        /// </summary>
        public string Specification { get; set; }

        /// <summary>
        /// 单位，最大长度20
        /// </summary>
        public string Unit { get; set; }

        /// <summary>
        /// 数量，默认为1，精度18位，小数2位
        /// </summary>
        public decimal Quantity { get; set; } = 1;

        /// <summary>
        /// 产品角色，最大长度20，默认为"自制"
        /// </summary>
        public string ProductRole { get; set; } = "自制";

        /// <summary>
        /// 工艺流程，最大长度100
        /// </summary>
        public string ProcessFlow { get; set; }

        /// <summary>
        /// 耗损率(%)，精度5位，小数2位
        /// </summary>
        public decimal? LossRate { get; set; }

        /// <summary>
        /// 制单人员，必填，最大长度50
        /// </summary>
        public string CreatedBy { get; set; }

        /// <summary>
        /// 创建日期，默认为当前时间
        /// </summary>
        public DateTime CreatedDate { get; set; } = DateTime.Now;

        /// <summary>
        /// 备注，最大长度500
        /// </summary>
        public string Remarks { get; set; }

        /// <summary>
        /// 子件列表，一对多关系
        /// </summary>
        public List<BomComponent> Components { get; set; } = new List<BomComponent>();
    }
}
